<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<script src="${ctx}/static/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<style>
<!--
.zhsq{ float:right; height:30px; width:auto; margin-top:7px; margin-left:-46px;} 
.zhsq ul{ height:30px; line-height:30px; margin-left:88px;}
.zhsq ul li{list-style:none; float:left; color:#5e6c79; font-size:14px; font-family:"Arial"; font-weight:bold; margin-right:32px;}
.zhsq ul li.lxqq{color:#5e6c79; font-size:14px; font-weight:normal; margin-right:13px;}
-->
</style>
<script type="text/javascript">
var s=true
function ch(){
	if(document.getElementById("loginFail"))
		document.getElementById("loginFail").innerHTML='';
	if(document.getElementById("username").value==""||document.getElementById("username").value==""){
		return false;
	}
	document.getElementById("btn").innerHTML='Loading...'
	if(s){
		s=false;
		document.getElementById("loginForm").submit();
	}
	return true;
}
function changeLang(lang) {
	$.ajax({
		type : "post",
		url : '<c:url value="/Proxy/change"/>',
		data : "locale=" + lang,
		async : true,
		error : function(data, error) {
		},
		success : function(data) {
			window.location.reload();
		}
	});
}
<shiro:authenticated> window.location.href="${ctx}/Proxy/home"; </shiro:authenticated>
$(document).ready(function(){
	<c:if test="${not empty locale}">
		$("#locale").val('${locale}');
	</c:if>	
})

</script>

<title><fmt:message key="global.system.title" /></title>
	<link type="text/css" href="${ctx}/static/login/login.css?v=1" rel="stylesheet" />
	</head>
	<body>
	<div id="container">
		<div class="logo" style="text-align:center; position:relative;width:auto">
			<a href="#"><img src="${ctx}/static/images/logo.gif" alt="" />
			</a>
			<a href="#">
			<img width="93px" height="54px" src="${ctx}/static/images/logo.jpg" alt=""/>
			</a>
		</div>

		<div id="box" style="height: 300px;text-align:center; width:800px;">
			<div style="width:auto; text-align:center">
			<form id="loginForm" action="${ctx}/login" method="post" class="form-horizontal" onsubmit="return ch();">
			<p class="main">
				<label>用户名: </label>
				<input type="text" id="username" name="username"  value="${username}" class="input-medium required"/>
				<label>密码: </label>
				<input type="password" id="password" name="password" class="input-medium required"/>
				<label>语言: 
					<select id="locale" name="locale" style="width:100px;">
							<option value="zh_CN">
								简体中文
							</option>
							<option value="en">
								英文
							</option>
					</select>
				</label>	
			</p>

			<p id="btn" class="space" style=" width:800px;">
				<!-- <input type="checkbox" id="rememberMe" name="rememberMe"/>Remember me</span> -->
				<input  id="submit_btn" type="submit" value="Login" class="login"/>
			</p>
			</form>
			</table>			
</form>
			
			<%
			String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
			if(error != null){
			%>
			<div id="loginFail" class="alertInfo" style="color: red;">
				<button class="close" data-dismiss="alert">×</button><fmt:message key="system.user.loginFail" />
				<p><fmt:message key="global.ie.restart" /></p>
			</div>
			<%
			}
			%>
			</div>
		</div><!-- 
		<div style="position: absolute;bottom: 10px;width: 100%">
		Copyright © 2013-2014 Cares . All right reserved.
		</div> -->


	</body>
</html>